package com.yanqu.road.server.timer.player;

import com.yanqu.road.server.manger.mammon.MammonMgr;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * 检测玩家饰品
 */
public class PlayerDecorationCheckTask extends GeneralTask {

	private Logger logger = LogManager.getLogger(this.getClass().getName());

	private long lastCheckTime;

	private boolean isRun = false;

	@Override
	public void doRun() {
		long nowTime = System.currentTimeMillis();
		if(nowTime - lastCheckTime > 60000 && !isRun){//一分钟检测一次
			isRun = true;
			try {
				MammonMgr.checkUserDecorationOverTime();
				lastCheckTime = nowTime;
			}catch (Exception e){
				logger.error("check decoration over time error:", e);
			}finally {
				isRun = false;
			}
		}
	}
}
